package net.lainiao.zhihu.common;

import org.springframework.core.io.support.PropertiesLoaderSupport;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by Administrator on 2016/1/11.
 */
public class CommonDataCache extends PropertiesLoaderSupport {
    private Properties properties;
    public synchronized Object get(String key) throws IOException {
        if(properties==null){
            properties=mergeProperties();
        }
        return properties.get(key);
    }

    public synchronized void put(String key, Object obj) throws IOException {
        if(properties==null){
            properties=mergeProperties();
        }
        properties.put(key,obj);
    }
}
